#include<iostream> #include<cstring> usingnamespacestd; constint maxn = 510; int w[maxn][maxn]; bool st[maxn]; int n, m; voiddfs(int u) { st[u] = 1; for(int i = 0; i < n; i ++){ if(w[u][i] && !st[i]){ dfs(i); } } } intget_num() { int res = 0; memset(st, 0, sizeof st); for(int i = 0; i < n; i ++){ if(!st[i]){ res ++; dfs(i); } } return res; } intmain() { cin >> n >> m; for(int i = 0; i < m; i ++){ int a, b; cin >> a >> b; w[a][b] = w[b][a] = 1; } int cnt0 = get_num(); int k; cin >> k; for(int i = 0; i < k; i ++){ int x; cin >> x; for(int i = 0; i < n; i ++){ w[i][x] = w[x][i] = 0; } int cnt = get_num(); if(cnt > cnt0 + 1) printf("Red Alert: City %d is lost!\n", x); elseprintf("City %d is lost.\n", x); cnt0 = cnt; if(i == n - 1) cout << "Game Over." << endl; } return0; }